package com.google.code.fulltank;

import com.google.code.fulltank.price.IsraeliFuelPriceHistory;
import com.google.code.fulltank.price.FuelPriceHistory;
import com.google.code.fulltank.strategy.ClairvoyantStrategy;
import com.google.code.fulltank.strategy.FuelingStrategy;
import com.google.code.fulltank.strategy.NaiveStrategy;
import com.google.code.fulltank.usage.FuelUsageHistory;
import com.google.code.fulltank.usage.UniformFuelUsageHistory;

/**
 * FuelTank main.
 * 
 * @author DL
 */
public class FullTankMain {

    public static void main(String[] args) throws Exception {
        FuelPriceHistory prices = new IsraeliFuelPriceHistory();
        FuelUsageHistory usage = new UniformFuelUsageHistory(
            3.22, prices.getFirstDate(), prices.getLastDate());

        FuelTank tank = new FuelTank(50, 50);
        FuelingStrategy strategy1 = new NaiveStrategy(tank, prices, usage);
        FuelingSimulator.FuelingStats stats1 =
            FuelingSimulator.simulate(tank, prices, usage, strategy1);
        System.out.println("Naive strategy fueled " + stats1.numFills + " times, total cost: " + stats1.cost);

        tank = new FuelTank(50, 50);
        FuelingStrategy strategy2 = new ClairvoyantStrategy(tank, prices, usage);
        FuelingSimulator.FuelingStats stats2 =
            FuelingSimulator.simulate(tank, prices, usage, strategy2);
        System.out.println("Optimal strategy fueled " + stats2.numFills + " times, total cost: " + stats2.cost);
    }
}
